package top.wardyan.wmes.rfid.pub;

import java.time.LocalDateTime;

import com.alibaba.fastjson.JSONObject;
import com.jfinal.core.ActionKey;
import com.jfinal.core.Path;

import top.wardyan.base.common.util.DateUtil;
import top.wardyan.common.ctrl.BaseController;
import top.wardyan.wmes.rfid.kqa.vo.BaseRequest;
import top.wardyan.wmes.rfid.kqa.vo.BaseResponse;

/**
 * @author Hechaobin
 * @Description
 * @since 2021-07-17
 */
@Path("/gst")
public class HomeController extends BaseController {
	
	
	private static final cn.hutool.log.Log log = cn.hutool.log.Log.get();
	
    // @PostMapping(value = "/get-server-time")
//	@ActionKey("/index")
//    public @ResponseBody BaseResponse<LocalDateTime> getServerTime(BaseRequest<String> request) {
//        log.info("获取系统时间，请求参数为：" + JSONObject.toJSON(request).toString());
//        BaseResponse<LocalDateTime> response = new BaseResponse<>();
//        response.setSuccess(LocalDateTime.now());
//        return response;
//    }

	@ActionKey("/get-server-time")
    public void index() {
		BaseRequest<String> params = this.getJson(BaseRequest.class);
  		if(log.isInfoEnabled()) {
  			log.info("获取系统时间,请求参数为:" + JSONObject.toJSONString(params));
  		}
        BaseResponse<LocalDateTime> response = new BaseResponse<>();
        response.setSuccess(DateUtil.formatNow());
        this.renderJson(response);
    }
}
